home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AppleScript - The Beta Release
/
AppleScript - The Beta Release.iso
/
Goodies
/
AutoGuest
/
SampleUse.c
< prev
Wrap
Text File
|
1991-09-18
|
2KB
|
46 lines
/*----------------------------------------------------------------------
This function shows the recommended way that your application
should use the authentication patches
Since these routines patch traps which change the behavior of
the OS, it is a good idea to avoid installing them whenever
possible. Ideally, your application will only call the
function 'InitialAESend' when it knows that it must start a
new session (i.e., it has a new address that it has never
messaged to before); at other times, it should call AESend
directly.
----------------------------------------------------------------------*/
OSErr InitialAESend( AppleEvent* question, AppleEvent* reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutTicks, IdleProcPtr idleProc, EventFilterProcPtr filterProc )
{
long oldPPC;
long oldNoInteraction;
Boolean useNoInteractionPatch;
OSErr theErr;
/*
// Install the two AutoGuest patches. Only put in
// the 'noInteractionPatch' if we really need it
*/
useNoInteractionPatch = !InForeGround();
oldPPC = InstallPPCAutoGuest();
if( useNoInteractionPatch )
oldNoInteraction = InstallNoInteractionPatch();
/*
// Now that we have installed the patch or patches,
// try the AESend
*/
theErr = AESend( question, reply, sendMode, sendPriority, timeOutTicks, idleProc, filterProc );
/*
// Deinstall any patch that we installed
*/
if( useNoInteractionPatch )
DeinstallNoInteractionPatch(oldNoInteraction);
DeinstallPPCAutoGuest(oldPPC);
return theErr;
}